<!DOCTYPE html>
<html lang="en" ng-app="AldeasInfantiles">
<head>
  <title>Aldeas Infantiles | Administrar Usuarios</title>
  <?php
	  $this->load->view('head_view');
  ?>
  <script src="<?php echo base_url("assets/js/users-view.js"); ?>"></script>
  <script src="<?php echo base_url("assets/js/menu-view.js"); ?>"></script>
</head>
<body>
  <div class="container" ng-controller="Users">
    <div class="masthead">
      <?php
        $this->load->view('nav_view');
      ?>
    </div>
    <div class="jumbotron">
      <form class="form-horizontal" role="form" id="form-edit-user">
          <h4>Editar Usuarios <span class="glyphicon glyphicon-user"></span></h4>
          <div class="row">
            <div class="col-xs-4">
              <label for="add-user-search" class="col-sm-2 control-label">Buscar:</label>
            </div>
            <div class="col-xs-4">
              <a href="#" data-toggle="modal" data-target="#modal-users" ng-click="showUsers()"><span class="glyphicon glyphicon-search"></span> Buscar</a>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="username" class="col-sm-2 control-label">Nombre:</label>
            </div>
            <div class="col-xs-4">
              <input type="text" class="form-control" ng-model="user.username" id="user.username" name="user.username" placeholder="Nombre" title="Escriba el nombre de usuario" autocomplete="off" required>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="usernick" class="col-sm-2 control-label">Nickname:</label>
            </div>
            <div class="col-xs-4">
              <input type="text" class="form-control" ng-model="user.usernick" id="user.usernick" name="user.usernick" placeholder="Nickname" title="Escriba el nickname de usuario" autocomplete="off" required>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="userpass" class="col-sm-2 control-label">Password:</label>
            </div>
            <div class="col-xs-4">
              <input type="password" class="form-control" ng-model="user.userpass" id="user.userpass" name="user.userpass" placeholder="Contrase&ntilde;a" title="Escriba la contrase&ntilde;a" autocomplete="off">
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="selectedType" class="col-sm-2 control-label">Tipo</label>
            </div>
            <div class="col-xs-4">
              <select id="selectedType" name="selectedType" class="form-control" title="Seleccione el tipo de usuario" 
                ng-model="selectedType"
                ng-options="type.id_tipousuario as type.ds_tipousuario for type in typeusers"
                >
              </select>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="selectedCountry" class="col-sm-2 control-label">Pa&iacute;s</label>
            </div>
            <div class="col-xs-4">
              <select id="selectedCountry" name="selectedCountry" class="form-control" title="Seleccione el pa&iacute;s del usuario" ng-change="requestDorps()"
                ng-model="selectedCountry"
                ng-options="country.id_pais as country.ds_pais for country in countries"
                >
              </select>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="selectedDorp" class="col-sm-2 control-label">Programa</label>
            </div>
            <div class="col-xs-4">
              <select id="selectedDorp" name="selectedDorp" class="form-control" title="Seleccione el programa del usuario" 
                ng-model="selectedDorp"
                ng-options="dorp.id_programa as dorp.ds_programa for dorp in dorps"
                >
              </select>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="selectedState" class="col-sm-2 control-label">Estado</label>
            </div>
            <div class="col-xs-4">
              <select class="form-control" ng-model="selectedState" id="selectedState" name="selectedState" title="Seleccione el estado del usuario">
                <option value="1">Activo</option>
                <option value="0">Inactivo</option>
              </select>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
            </div>
            <div class="col-xs-4">
              <input type="reset" class="btn btn-default" value="Cancelar"  />
              <input type="submit" class="btn btn-primary" value="Guardar" ng-click="getParams(user)" />
              <div id="messages-users" class="alert alert-dismissable {{alertClass}} {{hiddenClass}}">
                <strong>Mensaje!</strong> <span>{{errorMessage}}</span>
              </div>
            </div>
          </div>
      </form>

      <div class="modal fade" id="modal-users" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <h4 class="modal-title">Seleccione un usuario</h4>
            </div>
                <div class="modal-body">
          <form class="form-horizontal" role="form" id="user-form">
            <div class="row">
              <div class="col-xs-2">
                <h5>Filtrar:</h5>
              </div>
              <div class="col-xs-4">
                <input type="text" class="form-control" placeholder="Nombre del usuario" ng-model="query" id="userfilter" name="userfilter" value="" size="25" />
              </div>
            </div>
            <div class="list-group" role="navigation">
              <a ng-repeat="user in users | filter:query" ng-click="getUserId(user, $event)" href="" class="list-group-item">{{user.ds_usuario}}</a>
            </div>
          </form>
              </div>
            </div><!-- /.modal-content -->
          </div><!-- /.modal-dialog -->
      </div>

    </div>
    <?php
      $this->load->view('footer_view');
    ?>
  </div>
</body>
</html>